package com.yc.controller;


import com.yc.entity.Comment;
import com.yc.mapper.CommentMapper;
import com.yc.service.ICommentService;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * InnoDB free: 4096 kB 前端控制器
 * </p>
 *
 * @author ly
 * @since 2022-05-25
 */
@Controller
@RequestMapping("//comment")
public class CommentController {
    @Resource
    private CommentMapper commentMapper;
    @Resource
    private ICommentService commentService;

    @RequestMapping("queryByCtid")
    @ResponseBody
    public List< Comment > queryByCtid(Integer ctid){
        return commentMapper.queryByCtid(ctid);
    }

    @RequestMapping("addPraise")
    @ResponseBody
    public Integer addPraise(Integer cmid,Integer ctid,Integer uid){
        return commentMapper.addPraise(cmid,ctid,uid);
    }

    @RequestMapping("addStamp")
    @ResponseBody
    public Integer addStamp(Integer cmid,Integer ctid,Integer uid){
        return commentMapper.addStamp(cmid,ctid,uid);
    }

    @RequestMapping("discuss")
    @ResponseBody
    public Integer discuss(Integer ctid,Integer uid,String massage){
        return commentService.discuss(ctid,uid,massage);
    }
}

